//
//  AppInfoModel.m
//  BaseProject
//
//  Created by uxin on 17/2/20.
//  Copyright © 2017年 shopin. All rights reserved.
//

#import "AppInfoModel.h"
#import <UIKit/UIKit.h>

static AppInfoModel * appModel = nil;

@implementation AppInfoModel

+ (instancetype)sharedInstance{

    static dispatch_once_t predicate;

    dispatch_once(&predicate, ^{
    
        appModel = [[AppInfoModel alloc]init];
    
        appModel.deviceType = @"2";//1是android  2是IOS
        appModel.os = @"2";//1是android  2是IOS

        NSString *key=@"CFBundleShortVersionString";
        //加载程序中info.plist文件（获取当前软件的版本号）
        NSString *currentVerionCode=[NSBundle mainBundle].infoDictionary[key];
        appModel.appVersion = currentVerionCode;
        
        appModel.systemVersion = [[UIDevice currentDevice] systemVersion];;
        
        
        //加载程序中info.plist文件（获取当前软件的版本号 整型）
        NSString *keyInt = @"CFBundleShortVersionInt";
        NSNumber *currentVerionIntCode=[NSBundle mainBundle].infoDictionary[keyInt];
        appModel.versionNo = currentVerionIntCode?[NSString stringWithFormat:@"%@",currentVerionIntCode]:@"0";
        
        appModel.deviceSn = [[UIDevice currentDevice] identifierForVendor].UUIDString;
    });
    return appModel;
}


@end
